<?php

$basename = basename($zip_real);
if (strstr(I("post.zip"), "temp") && is_file($zip_real)) {
    //解压压缩文件
    $zips = getZipFileLists($zip_real);
    foreach($zips as $v){
        $zip_filename = $v['filename'];
        $zip_file =  get_extension($zip_filename);
   
        if(in_array($zip_file,array("php","exe"))){
            $s_admin_uid = getAdminId();
            addlog("" . $zip_filename . ",id:" . $id . "禁止文件,上传uid:".$s_admin_uid.",时间:".date("Y-m-d H:i:s")."" . $rs, "banner_files");
            $this->error("压缩包中".$zip_filename."不允许上传");
        }
    }
    $is_has_path = 0;
    foreach ($zips as $v) {
        if (in_array($v['filename'], array("index.html", "index.php"))) {
            $is_has_path++;
        }
    }
    
    $lists = scandir($file_path);
    foreach ($lists as $k => $v) {
        if ($k > 0) {
            $type = get_extension($v);
            if ($type == 'zip') {

                if ($v != $basename) {

//                            rmdir($v);
                }
            }
        }
    }
    deldir($file_path_demo);
    
    if ($is_has_path == 0) {
        replacePathExtract($zip_real, $file_path_demo, $zips[0]['filename']);
    } else {
        replacePathExtract($zip_real, $file_path_demo);
    }
    
}